package com.joysuch.wwyt.attendant.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.joysuch.wwyt.attendant.bean.AttendantAreaBean;
import com.joysuch.wwyt.attendant.bean.AttendantAreaReqBean;
import com.joysuch.wwyt.attendant.entity.AttendantArea;
import com.joysuch.wwyt.bp.bean.PositionCheckBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.exception.ApiBusinessException;
import com.joysuch.wwyt.core.exception.ApiCoreException;
import com.joysuch.wwyt.workflow.bean.CardLineBean;

import java.text.ParseException;
import java.util.List;

/**
 * 跟班区域
 *
 * @author xsx
 * @version 1.0
 * @date 2023/2/15 16:52
 */
public interface AttendantAreaService extends IService<AttendantArea> {

    /**
     * 查询区域集合
     *
     * @param ids
     * @return
     */
    List<AttendantArea> selectByIds(List<Long> ids);

    /**
     * 保存跟班区域
     *
     * @param bean
     */
    void saveEntity(AttendantAreaBean bean) throws ParseException;

    /**
     * 修改跟班区域
     *
     * @param bean
     * @throws ApiBusinessException
     */
    void updateEntity(AttendantAreaBean bean) throws ApiCoreException;

    /**
     * 批量新增跟班区域
     *
     * @param beans
     */
    void saveEntitys(List<AttendantAreaBean> beans) throws ParseException;

    /**
     * 查询跟班区域详情
     *
     * @param id
     * @return
     */
    AttendantAreaBean findById(Long id);

    /**
     * 查询跟班区域列表
     *
     * @param bean
     * @return
     */
    Page<AttendantAreaBean> selectPage(AttendantAreaReqBean bean);

    /**
     * 删除 跟班区域
     *
     * @param id
     */
    void deleteEntity(Long id)  throws ApiCoreException;


    /**
     * 位置校验
     * @param areaId
     * @param userId
     * @return
     */

    PositionCheckBean position(Long areaId, Long userId) throws ApiCoreException;

    List<Long> selectByName(String areaName);

    String findRailId(Long areaId);

    /**
     * 根据名称查id
     * @param areaName
     * @return
     */
    Long selectIdByName(String areaName);

    List<CardLineBean> selectList(String name);

    /**
     * 同步跟班区域
     * @param id
     */
    ResultBean syncArea(Long id);
}
